namespace CSharpPro._1023;

    public class Student
    {
        private string _name;
        private int _age;
        private string _studentId;
        private string _major;
        private double _score;
        
        public Student(string name, int age, string studentId, string major)
        {
            _name = name;
            _age = age;
            _studentId = studentId;
            _major = major;
            _score = 0; 
        }
        
        public void ShowInfo()
        {
            Console.WriteLine($"学生信息：");
            Console.WriteLine($"姓名：{_name}");
            Console.WriteLine($"年龄：{_age}");
            Console.WriteLine($"学号：{_studentId}");
            Console.WriteLine($"专业：{_major}");
            Console.WriteLine($"当前成绩：{_score}");
        }
        
        public void Study(string course)
        {
            Console.WriteLine($"{_name}正在学习《{course}》");
        }
        
        public void TakeExam(double score)
        {
            if (score >= 0 && score <= 100)
            {
                _score = score;
                Console.WriteLine($"{_name}参加考试，成绩为：{_score}");
            }
            else
            {
                Console.WriteLine("成绩无效，必须在0-100之间");
            }
        }
        
        public string Name => _name;
        public int Age => _age;
        public string StudentId => _studentId;
        public string Major => _major;
        public double Score => _score;
    }